home *** CD-ROM | disk | FTP | other *** search
- package koala.dynamicjava.classinfo;
-
- import java.util.Iterator;
- import java.util.List;
- import koala.dynamicjava.tree.ConstructorDeclaration;
- import koala.dynamicjava.tree.FormalParameter;
-
- public class TreeConstructorInfo implements ConstructorInfo {
- private ConstructorDeclaration constructorTree;
- private ClassFinder classFinder;
- private ClassInfo[] parameters;
- private ClassInfo[] exceptions;
- private ClassInfo declaringClass;
- private TypeVisitor typeVisitor;
-
- public ConstructorDeclaration getConstructorDeclaration() {
- return this.constructorTree;
- }
-
- public int getModifiers() {
- return this.constructorTree.getAccessFlags();
- }
-
- public ClassInfo[] getParameterTypes() {
- if (this.parameters == null) {
- List var1 = this.constructorTree.getParameters();
- Iterator var2 = var1.iterator();
- this.parameters = new ClassInfo[var1.size()];
-
- FormalParameter var4;
- for(int var3 = 0; var2.hasNext(); this.parameters[var3++] = (ClassInfo)var4.getType().acceptVisitor(this.typeVisitor)) {
- var4 = (FormalParameter)var2.next();
- }
- }
-
- return (ClassInfo[])this.parameters.clone();
- }
-
- public ClassInfo[] getExceptionTypes() {
- if (this.exceptions == null) {
- List var1 = this.constructorTree.getExceptions();
- Iterator var2 = var1.iterator();
- this.exceptions = new ClassInfo[var1.size()];
-
- for(int var3 = 0; var2.hasNext(); this.exceptions[var3++] = this.lookupClass((String)var2.next(), this.declaringClass)) {
- }
- }
-
- return (ClassInfo[])this.exceptions.clone();
- }
-
- public boolean equals(Object var1) {
- return var1 != null && var1 instanceof TreeConstructorInfo ? this.constructorTree.equals(((TreeConstructorInfo)var1).constructorTree) : false;
- }
-
- private ClassInfo lookupClass(String var1, ClassInfo var2) {
- try {
- return var2 == null ? this.classFinder.lookupClass(var1, var2) : this.classFinder.lookupClass(var1);
- } catch (ClassNotFoundException var4) {
- throw new NoClassDefFoundError(var4.getMessage());
- }
- }
-
- public TreeConstructorInfo(ConstructorDeclaration var1, ClassFinder var2, ClassInfo var3) {
- this.constructorTree = var1;
- this.classFinder = var2;
- this.declaringClass = var3;
- this.typeVisitor = new TypeVisitor(this.classFinder, this.declaringClass);
- }
- }
-